<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>destructuring</title>
</head>
<body>
<script>
    // 4、提取json数据
    var jsonData={
        id:'001',
        name:'zs',
        age:18,
        score: [{
            chinese: 98,
            shuxue: 97,
            eng: 91
        }]
    }
    console.log(jsonData);

    console.log('es5:');
    console.log('person name is:'+jsonData.name);
    console.log('person id is:'+jsonData.id);
    console.log('person age is:'+jsonData.age);
    console.log('person chinese is:'+jsonData.score[0].chinese);

    let {id:u_id,name:u_name,score:[{chinese:u_chinese}],age:u_age}=jsonData;
    console.log('es6:');
    console.log('person name is:'+u_name);
    console.log('person id is:'+u_id);
    console.log('person id is:'+u_age);
    console.log('person chinese is:'+u_chinese);
</script>
</body>
</html>